package com.cloud.pole.shop.biz.order;

import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Options;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.ace.cache.annotation.Cache;
import com.ace.cache.annotation.CacheClear;
import com.cloud.pole.common.biz.BaseBiz;
import com.cloud.pole.common.util.EntityUtils;
import com.cloud.pole.mapper.order.ShopOrderItemsMapper;
import com.cloud.pole.shop.model.entity.order.ShopOrder;
import com.cloud.pole.shop.model.entity.order.ShopOrderItems;
import com.cloud.pole.shop.model.entity.order.ShopOrderShoppingCart;

import tk.mybatis.mapper.entity.Example;
import tk.mybatis.mapper.entity.Example.Criteria;
/**
 * ${DESCRIPTION}
 *
 * @author wanghaobin
 * @create 2017-06-08 16:23
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class ShopOrderItemsBiz extends BaseBiz<ShopOrderItemsMapper, ShopOrderItems> {
	
	@Autowired
	ShopOrderItemsMapper shopOrderItemsMapper;
	
	@Override
    public void insertSelective(ShopOrderItems entity) {
        super.insertSelective(entity);
    }
	
	public ShopOrderItems selectByPrimaryKey(Long id) {
		return super.selectById(id);
	}
	
	@CacheClear(key="shopOrderItemsList{1.orderSn}")
	public void updateSelectiveById(ShopOrderItems entity) {
	       super.updateSelectiveById(entity);
	}
	
	@Cache(key="shopOrderItemsList{1}")
    public List<ShopOrderItems> selectOrderItemsList(String orderId) {
		 Example example = new Example(ShopOrderItems.class);
		 Criteria criteria = example.createCriteria();
         example.setOrderByClause("order_item_id");
		 criteria.andEqualTo("orderSn", orderId);
		 return selectByExample(example);
    }
}
